package com.hqd.ch03.v27.tx.transaction.support;

import com.hqd.ch03.v27.core.Ordered;

import java.io.Flushable;

public interface TransactionSynchronization extends Ordered, Flushable {

    int STATUS_COMMITTED = 0;
    int STATUS_ROLLED_BACK = 1;
    int STATUS_UNKNOWN = 2;


    @Override
    default int getOrder() {
        return Ordered.LOWEST_PRECEDENCE;
    }

    default void suspend() {
    }

    default void resume() {
    }

    @Override
    default void flush() {
    }

    default void beforeCommit(boolean readOnly) {
    }

    default void beforeCompletion() {
    }

    default void afterCommit() {
    }

    default void afterCompletion(int status) {
    }
}